package Text18;

import java.util.*;

public class Main {
    static int N = 1000010, cnt;
    static int[] pr = new int[N];
    static boolean[] st = new boolean[N];
    static int[] phi = new int[N];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        get_eulers(n);
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += phi[i];
        }
        System.out.println(sum);
    }
    private static void get_eulers(int n) {
        phi[1] = 1;
        int cnt=0;
        for (int i = 2; i <=n ; i++) {
            if(!st[i]){
                pr[cnt++]=i;
                phi[i]=i-1;
            }
            for (int j = 0; pr[j] <=n/i ; j++) {
                st[pr[j]*i]=true;
                if(i%pr[j]==0){
                    phi[pr[j]*i]=phi[i]*pr[j];
                    break;
                }
                phi[pr[j]*i]=phi[i]*(pr[j]-1);
            }
        }
    }
}
